package com.ruoyi.buss.grid.sq.service.impl;

import com.ruoyi.buss.customer.domain.DataCustomerInfo;
import com.ruoyi.buss.grid.sq.domain.DataWgGridInfo;
import com.ruoyi.buss.grid.sq.mapper.DataWgGridInfoMapper;
import com.ruoyi.buss.grid.sq.service.DataWgGridInfoService;
import com.ruoyi.system.api.model.LoginUser;
import org.springframework.stereotype.Service;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.PageRequest;

import javax.annotation.Resource;
import java.util.List;

/**
 * (DataWgGridInfo)表服务实现类
 *
 * @author andy
 * @since 2022-05-24 16:37:32
 */
@Service("dataWgGridInfoService")
public class DataWgGridInfoServiceImpl implements DataWgGridInfoService {
    @Resource
    private DataWgGridInfoMapper dataWgGridInfoDao;

    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    @Override
    public DataWgGridInfo queryById(Integer id) {
        return this.dataWgGridInfoDao.queryById(id);
    }

    @Override
    public List<DataWgGridInfo> queryList(LoginUser userInfo) {
        DataWgGridInfo dataWgGridInfo = new DataWgGridInfo();
        String orgId = userInfo.getSysUser().getDept().getOrgId();
        // 如果是admin用户不做处理
        if (userInfo.getRoles().contains("zhhz") || userInfo.getRoles().contains("common")) {
            dataWgGridInfo.setOrgCode(orgId);
        }
        return this.dataWgGridInfoDao.queryList(dataWgGridInfo);

    }



}
